home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************************
- * *
- * Copyright (c) 1992, 1993 Ronald Joe Record *
- * *
- * All rights reserved. No part of this program or publication may be *
- * reproduced, transmitted, transcribed, stored in a retrieval system, *
- * or translated into any language or computer language, in any form or *
- * by any means, electronic, mechanical, magnetic, optical, chemical, *
- * biological, or otherwise, without the prior written permission of: *
- * *
- * Ronald Joe Record (408) 458-3718 *
- * 212 Owen St., Santa Cruz, California 95062 USA *
- * *
- *************************************************************************/
-
- #include <stdio.h>
- #include <string.h>
- #include "x.h"
- #ifdef USE_3D
- #include "globals.h"
- #endif
-
- double window_distance = 10.0;
- int lowrange, start;
-
- void
- init_data()
- {
- static int i, fg, bg;
- extern image_data_t rubber_data;
- extern triple window_center;
- extern int Qflag, p_inc, q_inc, mandel, color_offset, reverse_video;
-
- numcolors = XDisplayCells(dpy, XDefaultScreen(dpy));
- displayplanes = DisplayPlanes(dpy, XDefaultScreen(dpy));
- if (numcolors > MAXCOLOR)
- numcolors = MAXCOLOR;
- if (numcolors <= 16) {
- STARTCOLOR = 3; MINCOLINDEX = 6;
- color_offset = 1;
- }
- numfreecols = numcolors - MINCOLINDEX;
- lowrange = MINCOLINDEX - STARTCOLOR;
- if ((lyap) || (mandel && find))
- start = MINCOLINDEX;
- else
- start = STARTCOLOR;
- if (Qflag == 4) {
- x_inc = x_range / 4.0;
- y_inc = y_range / 4.0;
- numrows = row = 4;
- p_inc = width / 4;
- q_inc = height / 4;
- }
- else {
- x_inc = x_range / (double)width;
- y_inc = y_range / (double)height;
- p_inc = 1;
- q_inc = 1;
- }
- point.x = 0;
- point.y = 0;
- row = 1; numrows = 1;
- maxexp = minexp = 0;
- x = rubber_data.p_min = min_x;
- y = rubber_data.q_min = min_y;
- rubber_data.p_max = max_x;
- rubber_data.q_max = max_y;
- if (show)
- show_defaults();
- srand48((long)time(0));
- AllInitBuffer();
- if (reverse_video) {
- fg = BlackPixel(dpy, XDefaultScreen(dpy));
- bg = WhitePixel(dpy, XDefaultScreen(dpy));
- }
- else {
- fg = WhitePixel(dpy, XDefaultScreen(dpy));
- bg = BlackPixel(dpy, XDefaultScreen(dpy));
- }
- BlackOnWhiteGC = XCreateGC(dpy, DefaultRootWindow(dpy),
- (unsigned long) 0, (XGCValues *) 0);
- /* set the background of the BlackOnWhite context to White */
- XSetBackground(dpy,BlackOnWhiteGC, WhitePixel(dpy, XDefaultScreen(dpy)));
- /* set the foreground of the BlackOnWhite context to Black */
- XSetForeground(dpy,BlackOnWhiteGC, BlackPixel(dpy, XDefaultScreen(dpy)));
- Reverse_GC = XCreateGC(dpy, DefaultRootWindow(dpy),
- (unsigned long) 0, (XGCValues *) 0);
- /* set the background of the reverse context to the normal foreground */
- XSetBackground(dpy,Reverse_GC, fg);
- /* set the foreground of the reverse context to the normal background */
- XSetForeground(dpy,Reverse_GC, bg);
- Data_GC[0] = XCreateGC(dpy, DefaultRootWindow(dpy),
- (unsigned long) 0, (XGCValues *) 0);
- /* set the background to black */
- XSetBackground(dpy,Data_GC[0], bg);
- /* set the foreground of the 0th context to black */
- XSetForeground(dpy,Data_GC[0], bg);
- Data_GC[1] = XCreateGC(dpy, DefaultRootWindow(dpy),
- (unsigned long) 0, (XGCValues *) 0);
- /* set the background to black */
- XSetBackground(dpy,Data_GC[1], bg);
- /* set the foreground of the 1st context to white */
- XSetForeground(dpy,Data_GC[1], fg);
- for (i=2; i<MAXCOLOR; i++) {
- Data_GC[i] = XCreateGC(dpy, DefaultRootWindow(dpy),
- (unsigned long) 0, (XGCValues *) 0);
- /* set the background to black */
- XSetBackground(dpy,Data_GC[i], bg);
- /* set the foreground of the ith context to i */
- XSetForeground(dpy, Data_GC[i], i);
- }
- #ifdef USE_3D
- /* Initialize these global constants for everyone's benefit */
- half_pi = M_PI / 2.0;
- two_pi = 2.0 * M_PI;
- radians_per_degree = M_PI / 180.0;
- degrees_per_radian = 180.0 / M_PI;
- /* Position the window on the z-axis */
- window_center.x = window_center.y = 0.0;
- window_center.z = WINDOW_DISTANCE;
- if (thermometer)
- vue_init(window_center, trawidth - THERMWIDTH, traheight);
- else
- vue_init(window_center, trawidth, traheight);
- #endif
- }
-